const express = require('express');
const router = express.Router();

const accountsController = require('../controllers/accountsController');
const goodsController = require('../controllers/goodsController');
const purchaseController = require('../controllers/purchaseController');
const salesController = require('../controllers/salesController');
const stockController = require('../controllers/stockController');

// Account routes
router.post('/login', accountsController.login);
router.get('/account', accountsController.getPersonalInfo);
router.put('/account', accountsController.updatePersonalInfo);
router.get('/employee', accountsController.getEmployees);
router.post('/employee', accountsController.addEmployee);
router.put('/employee/:id', accountsController.updateEmployee);
router.delete('/employee/:id', accountsController.deleteEmployee);
router.get('/employee/suggestions', accountsController.getSuggestions);

// Goods routes
router.get('/goods', goodsController.getGoods);
router.post('/goods', goodsController.addGoods);
router.put('/goods/:id', goodsController.updateGoods);
router.delete('/goods/:id', goodsController.deleteGoods);
router.get('/goods/suggestions', goodsController.getSuggestions);

// Purchase routes
router.get('/purchase', purchaseController.getPurchases);
router.post('/purchase', purchaseController.addPurchase);
router.put('/purchase/:id', purchaseController.updatePurchase);
router.delete('/purchase/:id', purchaseController.deletePurchase);
router.get('/purchase/suggestions', purchaseController.getSuggestions);

// Sales routes
router.get('/sales', salesController.getSales);
router.post('/sales', salesController.addSales);
router.put('/sales/:id', salesController.updateSales);
router.delete('/sales/:id', salesController.deleteSales);
router.get('/sales/suggestions', salesController.getSuggestions);

// Stock routes
router.get('/stock', stockController.getStock);
router.post('/stock', stockController.addStock);
router.put('/stock/:id', stockController.updateStock);
router.delete('/stock/:id', stockController.deleteStock);
router.get('/stock/suggestions', stockController.getSuggestions);

module.exports = router;
